package com.googlecode.mgwt.examples.showcase.server.jdo;

import java.util.Date;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;
import com.googlecode.mgwt.examples.showcase.shared.ServiceCallDTO;

@PersistenceCapable
public class ServiceCall {

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key key ;
	@Persistent
	private Date date;
	@Persistent
	private String comment;
	
	@Persistent
	private Integer addressID;
	@Persistent
	private Integer floorID;
	@Persistent
	private Integer severityID;
	
	public Key getKey() {
		return key;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}



	public Integer getAddressID() {
		return addressID;
	}
	public void setAddressID(Integer addressID) {
		this.addressID = addressID;
	}
	

	public Integer getFloorID() {
		return floorID;
	}

	public void setFloorID(Integer floorID) {
		this.floorID = floorID;
	}

	public Integer getSeverityID() {
		return severityID;
	}

	public void setSeverityID(Integer severityID) {
		this.severityID = severityID;
	}
	
	@Override
	public boolean equals(Object obj) {
		if(! (obj instanceof ServiceCall)){
			return false;
		}
		ServiceCall other = (ServiceCall)obj;
		return other.getAddressID().equals(addressID) &&
				other.getFloorID().equals(floorID);
	}
	
	
	
}
